home *** CD-ROM | disk | FTP | other *** search
/ TOS Silver 2000 / TOS Silver 2000.iso / programm / GNU_C++ / LIB / SRC / GEMLIB38.LZH / v_contrl.c < prev    next >
Encoding:
C/C++ Source or Header  |  1998-07-10  |  4.2 KB  |  211 lines

  1. /*
  2.  *    Vdi contrl functions library interface (part 1)
  3.  *
  4.  *    ++jrb    bammi@cadence.com
  5.  *    modified: mj -- ntomczak@vm.ucs.ualberta.ca
  6.  *
  7.  * -------------------------------------
  8.  * 12.07.97 cf (felsch@tu-harburg.de)
  9.  *        modified for new control arrays
  10.  *
  11.  * 15.06.98
  12.  *        - restructured, new bindings for all functions
  13.  */
  14. #include "gem.h"
  15.  
  16. void v_clrwk(int handle)
  17. {
  18.     vdi_control[0] = 3;
  19.     vdi_control[1] = 0;
  20.     vdi_control[3] = 0;
  21.     vdi_control[5] = 0;
  22.     vdi_control[6] = handle;
  23.     vdi(&vdi_params);
  24. }
  25.  
  26. void v_clsvwk(int handle)
  27. {
  28.     vdi_control[0] = 101;
  29.     vdi_control[1] = 0;
  30.     vdi_control[3] = 0;
  31.     vdi_control[5] = 0;
  32.     vdi_control[6] = handle;
  33.     vdi(&vdi_params);
  34. }
  35.  
  36. void v_clswk(int handle)
  37. {
  38.     vdi_control[0] = 2;
  39.     vdi_control[1] = 0;
  40.     vdi_control[3] = 0;
  41.     vdi_control[5] = 0;
  42.     vdi_control[6] = handle;
  43.     vdi(&vdi_params);
  44. }
  45.  
  46. int v_flushcache(int handle)
  47. {
  48.     vdi_control[0] = 251;
  49.     vdi_control[1] = 0;
  50.     vdi_control[3] = 0;
  51.     vdi_control[5] = 0;
  52.     vdi_control[6] = handle;
  53.     vdi(&vdi_params);
  54.     return vdi_intout[0];
  55. }
  56.  
  57. int v_loadcache(int handle, char *filename, int mode)
  58. {
  59.     short i;
  60.     
  61.     vdi_intin[0] = mode;
  62.     i = vdi_str2array(filename, vdi_intin+1);
  63.     vdi_control[0] = 250;
  64.     vdi_control[1] = 0;
  65.     vdi_control[3] = i;
  66.     vdi_control[5] = 0;
  67.     vdi_control[6] = handle;
  68.     vdi(&vdi_params);
  69.     return vdi_intout[0];
  70. }
  71.  
  72. void v_opnvwk(int work_in[], int *handle, int work_out[])
  73. {
  74. #ifndef __MSHORT___
  75.     register int    i;
  76.     
  77.     for (i = 0; i<11; i++)
  78.         vdi_intin[i] = work_in[i];
  79. #else
  80.     vdi_params.intin = &work_in[0];
  81.     vdi_params.intout = &work_out[0];
  82.     vdi_params.ptsout = &work_out[45];
  83. #endif
  84.     
  85.     vdi_control[0] = 100;
  86.     vdi_control[1] = 0;
  87.     vdi_control[3] = 11;
  88.     vdi_control[5] = 0;
  89.     vdi_control[6] = *handle;
  90.     vdi(&vdi_params);
  91.     
  92. #ifndef __MSHORT___
  93.     for (i = 0; i<45; i++)
  94.         work_out[i] = vdi_intout[i];
  95.     for (i = 0; i<12; i++)
  96.         work_out[i+45] = vdi_ptsout[i];
  97. #else
  98.     vdi_params.intin = &vdi_intin[0];
  99.     vdi_params.intout = &vdi_intout[0];
  100.     vdi_params.ptsout = &vdi_ptsout[0];
  101. #endif
  102.     *handle = vdi_control[6];
  103. }
  104.  
  105. void v_opnwk(int work_in[], int *handle, int work_out[])
  106. {
  107. #ifndef __MSHORT__
  108.     register int    i;
  109.     
  110.     for (i = 0; i<16; i++)
  111.         vdi_intin[i] = work_in[i];
  112. #else
  113.     vdi_params.intin = (short *)&work_in[0];
  114.     vdi_params.intout = (short *)&work_out[0];
  115.     vdi_params.ptsout = (short *)&work_out[45];
  116. #endif
  117.     
  118.     vdi_control[0] = 1;
  119.     vdi_control[1] = 0;
  120.     vdi_control[3] = 16;
  121.     vdi_control[5] = 0;
  122.     vdi_control[6] = 0;
  123.     vdi(&vdi_params);
  124.     
  125. #ifndef __MSHORT__
  126.     for (i = 0; i<45; i++)
  127.         work_out[i] = vdi_intout[i];
  128.     for (i = 0; i<12; i++)
  129.         work_out[i+45] = vdi_ptsout[i];
  130. #else
  131.     vdi_params.intin = &vdi_intin[0];
  132.     vdi_params.intout = &vdi_intout[0];
  133.     vdi_params.ptsout = &vdi_ptsout[0];
  134. #endif
  135.     *handle = vdi_control[6];
  136. }
  137.  
  138. int v_savecache(int handle, char *filename)
  139. {
  140.     short i;
  141.     
  142.     i = vdi_str2array(filename, vdi_intin);
  143.     vdi_control[0] = 249;
  144.     vdi_control[1] = 0;
  145.     vdi_control[3] = i;
  146.     vdi_control[5] = 0;
  147.     vdi_control[6] = handle;
  148.     vdi(&vdi_params);
  149.     return vdi_intout[0];
  150. }
  151.  
  152. void v_set_app_buff(int handle, void *buf_p, int size)
  153. {
  154.     *((void **)(&vdi_intin[0])) = buf_p;
  155.     vdi_intin[3] = size;
  156.     vdi_control[0] = -1;
  157.     vdi_control[1] = 0;
  158.     vdi_control[3] = 3;
  159.     vdi_control[5] = 6;
  160.     vdi_control[6] = handle;
  161.     vdi(&vdi_params);
  162. }
  163.  
  164. void v_updwk(int handle)
  165. {
  166.     vdi_control[0] = 4;
  167.     vdi_control[1] = 0;
  168.     vdi_control[3] = 0;
  169.     vdi_control[5] = 0;
  170.     vdi_control[6] = handle;
  171.     vdi(&vdi_params);
  172. }
  173.  
  174. void vs_clip(int handle, int clip_flag, int pxyarray[])
  175. {
  176.     register int i;
  177.     
  178.     vdi_intin[0] = clip_flag;
  179.     for(i = 0; i < 4; i++)
  180.         vdi_ptsin[i] = pxyarray[i];
  181.     vdi_control[0] = 129;
  182.     vdi_control[1] = 2;
  183.     vdi_control[3] = 1;
  184.     vdi_control[5] = 0;
  185.     vdi_control[6] = handle;
  186.     vdi(&vdi_params);
  187. }
  188.  
  189. int vst_load_fonts(int handle, int select)
  190. {
  191.     vdi_intin[0] = select;
  192.     vdi_control[0] = 119;
  193.     vdi_control[1] = 0;
  194.     vdi_control[3] = 1;
  195.     vdi_control[5] = 0;
  196.     vdi_control[6] = handle;
  197.     vdi(&vdi_params);
  198.     return vdi_intout[0];
  199. }
  200.  
  201. void vst_unload_fonts(int handle, int select)
  202. {
  203.     vdi_intin[0] = select;
  204.     vdi_control[0] = 120;
  205.     vdi_control[1] = 0;
  206.     vdi_control[3] = 1;
  207.     vdi_control[5] = 0;
  208.     vdi_control[6] = handle;
  209.     vdi(&vdi_params);
  210. }
  211.